<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Draws an open polygon</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.imageopenpolygon" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imageopenpolygon</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.2.0)</p><p class="refpurpose"><span class="refname">imageopenpolygon</span> &mdash; <span class="dc-title">Draws an open polygon</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.imageopenpolygon-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>imageopenpolygon</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$image</code></span>
   , <span class="methodparam"><span class="type">array</span> <code class="parameter">$points</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$num_points</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$color</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>imageopenpolygon()</strong></span> draws an open polygon on the given
   <code class="parameter">image</code>. Contrary to <span class="function"><a href="imagepolygon.html" class="function">imagepolygon()</a></span>,
   no line is drawn between the last and the first point.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.imageopenpolygon-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    <dt>
<code class="parameter">image</code></dt>

<dd>
<p class="para">由图象创建函数(例如<span class="function"><a href="imagecreatetruecolor.html" class="function">imagecreatetruecolor()</a></span>)返回的图象资源。</p></dd>

    
     <dt>
<code class="parameter">points</code></dt>

     <dd>

      <p class="para">
       An array containing the polygon&#039;s vertices, e.g.:
       <table class="doctable informaltable">
        
         <tbody class="tbody">
          <tr>
           <td>points[0]</td>
           <td>= x0</td>
          </tr>

          <tr>
           <td>points[1]</td>
           <td>= y0</td>
          </tr>

          <tr>
           <td>points[2]</td>
           <td>= x1</td>
          </tr>

          <tr>
           <td>points[3]</td>
           <td>= y1</td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>

    
    
     <dt>
<code class="parameter">num_points</code></dt>

     <dd>

      <p class="para">
       Total number of points (vertices).
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">color</code></dt>

     <dd>

      <p class="para">
       A color identifier created with <span class="function"><a href="imagecolorallocate.html" class="function">imagecolorallocate()</a></span>.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.imageopenpolygon-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.imageopenpolygon-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3723">
    <p><strong>Example #1 <span class="function"><strong>imageopenpolygon()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Create&nbsp;a&nbsp;blank&nbsp;image<br /></span><span style="color: #0000BB">$image&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecreatetruecolor</span><span style="color: #007700">(</span><span style="color: #0000BB">400</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">300</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Allocate&nbsp;a&nbsp;color&nbsp;for&nbsp;the&nbsp;polygon<br /></span><span style="color: #0000BB">$col_poly&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$image</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Draw&nbsp;the&nbsp;polygon<br /></span><span style="color: #0000BB">imageopenpolygon</span><span style="color: #007700">(</span><span style="color: #0000BB">$image</span><span style="color: #007700">,&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">200</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">300</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">200<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$col_poly</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Output&nbsp;the&nbsp;picture&nbsp;to&nbsp;the&nbsp;browser<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-type:&nbsp;image/png'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">imagepng</span><span style="color: #007700">(</span><span style="color: #0000BB">$image</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">imagedestroy</span><span style="color: #007700">(</span><span style="color: #0000BB">$image</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="mediaobject">
     
     <div class="imageobject">
      <img src="images/21009b70229598c6a80eef8b45bf282b-imageopenpolygon.png" alt="Output of example : imageopenpolygon()" width="400" height="300" />
     </div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.imageopenpolygon-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="imagepolygon.html" class="function" rel="rdfs-seeAlso">imagepolygon()</a> - 画一个多边形</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>